//
//  ZLNotification.h
//  ZLNotification
//
//  Created by 科大物联 on 2023/7/7.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN
typedef void (^ZLNotificationItemComplete)(NSNotification *notification);

@interface ZLNotification : NSObject

/// 发通知
/// - Parameters:
///   - name: 通知名
///   - object: 携带数据
+ (void)postNotification:(NSString *)name object:(id)object;

/// 订阅通知
/// - Parameters:
///   - target: 标识
///   - name: 通知名
///   - complete: 通知回调
+ (void)addNotification:(NSString *)target name:(NSString *)name complete:(ZLNotificationItemComplete)complete;

/// 订阅通知
/// - Parameters:
///   - target: 标识
///   - name: 通知名
///   - object: 携带参数
///   - complete: 通知回调
+ (void)addNotification:(NSString *)target name:(NSString *)name object:(id)object complete:(ZLNotificationItemComplete)complete;

/// 根据标识移除订阅
/// - Parameter target: 标识
+ (void)removeNotification:(NSString *)target;

/// 根据标识和名称移除订阅
/// - Parameters:
///   - target: 标识
///   - name: 名字
+ (void)removeNotification:(NSString *)target name:(NSString *)name;

/// 移除所有订阅
+ (void)removeAllNotification;

@end

NS_ASSUME_NONNULL_END
